# ActionButtons

The `<ActionButtons>` component renders a **primary action button** (e.g 'Submit'), as well as a **secondary action button** (e.g 'Cancel').
They can be helpful for forms, dialogs and other things that require an action.

## Import

```jsx
import { ActionButtons } from 'bumbag';
```

## Usage

```jsx-live
<ActionButtons
  onClickSubmit={() => console.log('submitted')}
  onClickCancel={() => console.log('cancelled')}
/>
```

### Colors

Action buttons can also take a color from the palette using the `palette` prop.

```jsx-live
<Set orientation="vertical">
  <ActionButtons
    palette="secondary"
    onClickSubmit={() => console.log('submitted')}
    onClickCancel={() => console.log('cancelled')}
  />
  <ActionButtons
    palette="danger"
    onClickSubmit={() => console.log('submitted')}
    onClickCancel={() => console.log('cancelled')}
  />
</Set>
```

### Custom text

To modify the text of the buttons, use the `submitText` and/or `cancelText` props.

```jsx-live
<ActionButtons
  cancelText="Close"
  submitText="Save"
  onClickSubmit={() => console.log('submitted')}
  onClickCancel={() => console.log('cancelled')}
/>
```

### Loading

To indicate the primary button as loading, use the `isLoading` prop.

```jsx-live
<ActionButtons
  isLoading
  onClickSubmit={() => console.log('submitted')}
  onClickCancel={() => console.log('cancelled')}
/>
```

### Type

To change the type of the submit button (e.g `submit` or `reset`). Use the `type` prop.

```jsx-live
<ActionButtons type="submit" />
```

### Custom props

You can pass custom button props to action buttons using `submitProps` or `cancelProps`.

```jsx-live
<ActionButtons
  cancelText="Reject"
  submitProps={{ disabled: true }}
  cancelProps={{ palette: 'danger' }}
/>
```

### Addon buttons

```jsx-live
<ActionButtons
  addonButtons={
    <React.Fragment>
      <Button palette="danger" variant="outlined">
        Delete
      </Button>
      <Button palette="primary" variant="outlined">
        Save draft
      </Button>
    </React.Fragment>
  }
/>
```

## ActionButtons Props

<!-- Automatically generated -->

**<Code fontSize="150" marginRight="major-1">addonButtons</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`ReactElement<any, string
  | ((props: any) => ReactElement<any, string
  | ...
  | (new (props: any) => Component<any, any, any>)>)
  | (new (props: any) => Component<any, any, any>)>`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">cancelProps</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`{
  unstable_system?: any;
  top?: any;
  right?: any;
  bottom?: any;
  left?: any;
  defaultChecked?: boolean;
  defaultValue?: string | number | string[];
  suppressContentEditableWarning?: boolean;
  suppressHydrationWarning?: boolean;
  ... 673 more ...;
  ignoreGrayOverride?: boolean;
}`}
</Code>

Custom button props for the cancel button

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">cancelText</Code>** <Code fontSize="100" palette="primary">string</Code> 

Custom text for the cancel button

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">isLoading</Code>** <Code fontSize="100" palette="primary">boolean</Code> 

Makes the submit button in a loading state

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">onClickSubmit</Code>** <Code fontSize="100" palette="primary">() =&#62; void</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">onClickCancel</Code>** <Code fontSize="100" palette="primary">() =&#62; void</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">palette</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`"default"
  | "primary"
  | "secondary"
  | "success"
  | "danger"
  | "warning"
  | (string & {})`}
</Code>

Changes the color of the submit button

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">size</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`"default"
  | (string & {})
  | "small"
  | "medium"
  | "large"`}
</Code>

Size of the buttons

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">submitProps</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`{
  unstable_system?: any;
  top?: any;
  right?: any;
  bottom?: any;
  left?: any;
  defaultChecked?: boolean;
  defaultValue?: string | number | string[];
  suppressContentEditableWarning?: boolean;
  suppressHydrationWarning?: boolean;
  ... 673 more ...;
  ignoreGrayOverride?: boolean;
}`}
</Code>

Custom button props for the submit button

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">submitText</Code>** <Code fontSize="100" palette="primary">string</Code> 

Custom text for the submit button

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">type</Code>** <Code fontSize="100" palette="primary">&#34;submit&#34; | &#34;reset&#34; | &#34;button&#34;</Code> 

Button type of the submit button

<Divider marginTop="major-2" marginBottom="major-2" />

<details><Box use="summary" marginBottom="major-2">Inherits <strong><code>Set</code></strong> props</Box>

**<Code fontSize="150" marginRight="major-1">isFilled</Code>** <Code fontSize="100" palette="primary">boolean</Code> 

Indicates if the set items should span the width of the set.

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">orientation</Code>** <Code fontSize="100" palette="primary">&#34;horizontal&#34; | &#34;vertical&#34;</Code> 

Indicates the orientation of the set.

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">spacing</Code>** <Code fontSize="100" palette="primary">string</Code> 

Sets the spacing between items.

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">verticalBelow</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`"tablet"
  | "mobile"
  | "fullHD"
  | "widescreen"
  | "desktop"
  | "min-fullHD"
  | "max-fullHD"
  | "min-widescreen"
  | "max-widescreen"
  | "min-desktop"
  | "max-desktop"
  | "min-tablet"
  | "max-tablet"
  | "min-mobile"
  | "max-mobile"`}
</Code>

Indicates the breakpoint at which the set should become vertical.

<Divider marginTop="major-2" marginBottom="major-2" />

</details>
            

<details><Box use="summary" marginBottom="major-2">Inherits <strong><code>Box</code></strong> props</Box>

**<Code fontSize="150" marginRight="major-1">use</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`string
  | (ComponentClass<any, any> & { useProps: any; })
  | (FunctionComponent<any> & { useProps: any; })`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">className</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">children</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`string
  | number
  | boolean
  | {}
  | ReactElement<any, string
  | ((props: any) => ReactElement<any, string
  | ...
  | (new (props: any) => Component<any, any, any>)>)
  | (new (props: any) => Component<...>)>
  | ReactNodeArray
  | ReactPortal
  | ((props: BoxProps) => ReactNode)`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">alignX</Code>** <Code fontSize="100" palette="primary">&#34;right&#34; | &#34;left&#34; | &#34;center&#34;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">alignY</Code>** <Code fontSize="100" palette="primary">&#34;top&#34; | &#34;bottom&#34; | &#34;center&#34;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">variant</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">colorMode</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">disabled</Code>** <Code fontSize="100" palette="primary">boolean</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">overrides</Code>**  

<Code isBlock palette="primary" fontSize="150" padding="minor-1" marginBottom="major-2">
{`{
  useCSSVariables?: boolean;
  altitudes?: AltitudesThemeConfig;
  borders?: BordersThemeConfig;
  borderRadii?: BorderRadiiThemeConfig;
  ... 96 more ...;
  Template?: TemplateThemeConfig;
}`}
</Code>

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">elementRef</Code>** <Code fontSize="100" palette="primary">((instance: any) =&#62; void) | RefObject&#60;any&#62;</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

**<Code fontSize="150" marginRight="major-1">themeKey</Code>** <Code fontSize="100" palette="primary">string</Code> 

<Divider marginTop="major-2" marginBottom="major-2" />

</details>
            

## Theming

<Theme
  component={'ActionButtons'}
  overrides={['ActionButtons.styles.base', 'ActionButtons.styles.child.base', 'ActionButtons.styles.child.first', 'ActionButtons.styles.child.middle', 'ActionButtons.styles.child.last']}/>
